package day06.practise;

import java.util.Arrays;
import java.util.Scanner;

public class CalAvg {
    public static void main(String[] args) {
        int n=3;
        double[]score=getScoreArray(n);
        double avgScore=getAvgScore(score);
        System.out.println("去掉最低分,最高分的平均成绩:"+avgScore);
    }

    private static double[] getScoreArray(int n) {
        double score[]=new double[n];
        Scanner scanner=new Scanner(System.in);
        for (int i = 0; i <n ; i++) {
            score[i]=scanner.nextDouble();
        }
        return score;
    }

    private static double getAvgScore(double[] score) {
        double totalScore=0;
        Arrays.sort(score);
        for (int i = 1; i <score.length-1 ; i++) {
            totalScore+=score[i];
        }
        return totalScore/(score.length-2);
    }
}
